import React, { Component } from 'react'

export default class Footer extends Component {
    render() {
        const {todos} = this.props
        const total = todos.length

        const count = todos.reduce((pre,current)=>{return pre+(current.done?1:0)},0)

        return (
            <div className="footer">
                <input type="checkbox" checked={total==count} onChange={this.props.selectAll}/>已完成: {count} / 总计: {total}<button onClick={this.props.clearAllFinished}>删除所有</button>
            </div>
        )
    }
}
